﻿using System;
using System.Collections;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Presentation.Shapes;
using Microsoft.SPOT.Touch;

using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using Gadgeteer.Modules.GHIElectronics;
using Gadgeteer.Interfaces;
using Gadgeteer.Interfaces.Sample.Safe.SafeApp;

namespace SafeApp.FezSpider
{
    public partial class Program
    {
        Lock padLock;
        CombinationEntering lockTurner;
        IDoor door;

        // This method is run when the mainboard is powered up or reset.   
        void ProgramStarted()
        {
            /*******************************************************************************************
            This sample simulates a lock. You have to press the buttons in the right order to unlock
             * The current access code is: button 1, button 2, button 2, button 1.
            
            If you want to do something periodically, use a ServiceLocator.Factories.TimerFactory.
            *******************************************************************************************/

            Debug.Print("Program Starting");

            ServiceLocator.Locator.Setup();

            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.

            padLock = new Lock(new[] { 0, 1, 1, 0 });

            lockTurner = new CombinationEntering(
                padLock,
                button.AsInterface(), button2.AsInterface()
                );

            door = new MultiColorLedAsDoor(padLock, multicolorLed.AsInterface());

            Debug.Print("Program Started");
        }
    }
}
